export const detailConfig = {
	label: '菜单信息',
	prop: 'base0',
	inline: false,
	showBtn: false,
	labelPosition: 'left',
	column: [
		{
			label: '菜单名称',
			prop: 'name',
			span: 24,
		},
		{
			label: '菜单类型',
			prop: 'type',
			custome: 'tag',
			dicData: [
				{ label: '菜单', value: '0' },
				{ label: '操作', value: '1' },
			],
			span: 24,
			control: (e, model) => {
				return {
					path: {
						display: e == 0,
					},
					permission: {
						display: e == 1,
					},
					icon: {
						display: e == 0,
					},
				}
			},
			rules: [{ required: true, message: '请选择菜单类型' }],
		},
		{
			label: '菜单地址',
			prop: 'path',
			span: 24,
		},
		{
			label: '权限名称',
			prop: 'permission',
			display: false,
			span: 24,
		},
		{
			label: '菜单图标',
			prop: 'icon',
			type: 'IconSelect',
			span: 24,
		},
		{
			label: '上级菜单',
			prop: 'parentName',
			type: 'input',
			span: 24,
		},
		{
			label: '菜单排序',
			prop: 'sort',
			span: 24,
		},
	],
}

export const formConfig = (type?: string) => {
	const obj = {
		label: '菜单信息',
		inline: false,
		showBtn: type == 'next',
		showReset: false,
		labelPosition: 'left',
		column: [
			{
				label: '菜单名称',
				prop: 'name',
				type: 'text',
				maxlength: '50',
				showWordLimit: true,
				span: 24,
				rules: [{ required: true, message: '请输入菜单名称' }],
			},
			{
				label: '菜单类型',
				prop: 'type',
				type: 'radio',
				disabled: true,
				dicData: [
					{ label: '菜单', value: '0' },
					{ label: '操作', value: '1' },
				],
				span: 24,
				control: (e, model) => {
					return {
						path: {
							display: e == 0,
						},
						permission: {
							display: e == 1,
						},
						icon: {
							display: e == 0,
						},
					}
				},
				rules: [{ required: true, message: '请选择菜单类型' }],
			},
			{
				label: '菜单地址',
				prop: 'path',
				type: 'text',
				readonly: true,
				maxlength: '140',
				showWordLimit: true,
				display: true,
				span: 24,
			},
			{
				label: '权限名称',
				prop: 'permission',
				type: 'text',
				readonly: true,
				maxlength: '50',
				showWordLimit: true,
				display: false,
				span: 24,
				rules: [{ required: true, message: '请输入权限名称' }],
			},
			{
				label: '菜单图标',
				prop: 'icon',
				type: 'IconSelect',
				span: 24,
			},
			{
				label: '菜单排序',
				prop: 'sort',
				type: 'input',
				span: 24,
				rules: [{ required: true, message: '请输入菜单排序' }],
			},
		],
	}
	if (type !== 'next') {
		obj.column.push({
			label: '上级菜单',
			prop: 'parentId',
			type: 'input',
			span: 24,
			rules: [{ required: true, message: '请选择上级菜单' }],
		})
	}
	return obj
}
